package com.atguigu.lease.web.app.custom.config;

import com.atguigu.lease.web.app.custom.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author 快点干早点散
 * @Create 2025/4/2 14:29
 * Description:
 */
@Configuration
public class SpringMVCConfoguration implements WebMvcConfigurer {
    @Value("${web.app.auth-include}")
    private String[] include;
    @Value("${web.app.auth-exclude}")
    private String[] exclude;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor()).addPathPatterns(include).excludePathPatterns(exclude).order(1);
    }
}
